package com.aqie.demo;

import com.aqie.demo.application_context.ApplicationContextStore;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;

//@EnableScheduling
@EnableAsync
@ServletComponentScan("com.aqie.demo")
@SpringBootApplication(scanBasePackages = {"com.aqie.demo", "com.out"})
public class DemoApplication {

    public static void main(String[] args) {
        // SpringApplication.run(DemoApplication.class, args);

        // 第一种方式获取应用上下文
        /*SpringApplication application = new SpringApplication(
                DemoApplication.class
        );
        application.addInitializers(new UseIntitiallizer());
        application.run(args);*/

        // 第三种方式获取应用上下文
        ApplicationContextStore.setApplicationContext(
                SpringApplication.run(DemoApplication.class, args)
        );

    }

}
